<template>
  <el-dialog :title="title" :close-on-click-modal="false" :fullscreen="true" :visible.sync="visible"
    :before-close="cancel" class="JNPF-dialog JNPF-dialog_center" lock-scroll width="50%">
    <el-row class="JNPF-common-search-box" :gutter="16">
      <el-form @submit.native.prevent ref="elForm" :model="dataForm" :rules="rules">
        <el-col :span="8">
          <el-form-item label="场地名称" prop="FPOINT">
            <el-input v-model="dataForm.FPOINT"  disabled />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="固定资产码" prop="FCATNO">
            <el-input v-model="dataForm.FCATNO"  disabled />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="设备序列号" prop="FCATNO2">
            <el-input v-model="dataForm.FCATNO2"  disabled />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="设备名称" prop="FCATNAME">
            <el-input v-model="dataForm.FCATNAME"  disabled />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="上次保养日期" prop="FBILLCREDATE">
            <el-input v-model="dataForm.FBILLCREDATE"  disabled />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="下次保养日期" prop="FBILLUPDDATE">
            <el-input v-model="dataForm.FBILLUPDDATE"  disabled />
          </el-form-item>
        </el-col>

        <el-col :span="16">
          <el-form-item label="备注" prop="FMEMO">
            <el-input v-model="dataForm.FMEMO"  disabled />
          </el-form-item>
        </el-col>

        <el-col :span="5">
          <el-form-item label="">
            <!-- <el-button type="success" icon="el-icon-plus" @click="insert">添加设备</el-button> -->
            <el-button type="primary" :loading="loading">返回</el-button>
          </el-form-item>
        </el-col>
      </el-form>
    </el-row>

    <el-table :data="list1" border stripe>
          <el-table-column prop="FENTRYID" label="序号" width="75" ></el-table-column>
          <el-table-column prop="FCATNO" label="保养日期" ></el-table-column>
          <el-table-column prop="FUSER" label="保养人员" ></el-table-column>
          <el-table-column prop="FCATNAME" label="保养项目" ></el-table-column>
          <el-table-column prop="FCATLEVEL" label="保养级别" ></el-table-column>
          <el-table-column prop="FMEMO" label="备注" ></el-table-column>
        </el-table>

    <StudqueryFcuston ref="StudqueryFcuston" @confirm="shoplist" />
  </el-dialog>
</template>

<script>
  import StudqueryFcuston from "@/components/StudqueryFcuston/StudqueryFcuston.vue"
  import jnpf from "@/utils/jnpf"
  export default {
    components: { StudqueryFcuston },
    props: {
      formationlist: {
        type: Array,
        default: [],
      },
    },
    data() {
      return {
        title: "新增",
        insertorupdate: true,
        dataForm: {
            FBILLNO: "K241130002", 
            FBILLCREDATE:"2024-11-30",
            BILLUPDDATE:"2025-01-30",
            FCATNO: "TG(6543)65456",
            FMEMO: "",
            FBEGDATE: "2024-12-01",
            FENDDATE: "2025-11-30",
            FCATNAME:"1号通风柜",
            FPOINT:"奉1教楼102",
            FCHECKUSE: "汉武帝",
            FCHECKDATE: "2024-11-30 13:50:01",
            FNOTE:"",
            FBILLSTATE: "已通过"
        },
        rules: {
          FUSER: [
            { required: true, message: '请输入报修人员', trigger: 'blur' },
          ],
          FMEMO: [
            { required: true, message: '请输入报修说明', trigger: 'blur' },
          ],
        },

        loading: false,
        visible: false,

        list1:[
          {FENTRYID:1,FCATNO:"2024-09-01",FUSER:"韩信",FCATNAME:"月保养",FCATLEVEL:"二级保养",FMEMO:""},
          {FENTRYID:2,FCATNO:"2024-10-01",FUSER:"韩信",FCATNAME:"月保养",FCATLEVEL:"二级保养",FMEMO:""},
          {FENTRYID:2,FCATNO:"2024-11-01",FUSER:"韩信",FCATNAME:"月保养",FCATLEVEL:"二级保养",FMEMO:""},
        ],

        //所属校区选择数据
        options1: [{
          value: '1',
          label: '申请中'
        }, {
          value: '2',
          label: '已通过'
        }, {
          value: '3',
          label: '已驳回'
        }],

        //仓库
        options2: [{
          value: '1',
          label: '化学系仓库'
        }, {
          value: '2',
          label: '生物系仓库'
        }],

        //供应商
        options3: [{
          value: '1',
          label: '奉1教楼101'
        }, {
          value: '2',
          label: '奉1教楼102'
        }, {
          value: '3',
          label: '奉综合楼201'
        }, {
          value: '4',
          label: '奉综合楼202'
        }],
        
      };
    },
    created() {
    },
    mounted() { },
    methods: {
      //
      init(FBILLNO) {
        this.dataForm.FBILLNO = FBILLNO;
        if (this.dataForm.FBILLNO) {
          this.title = "查看详情"
          this.insertorupdate = false;
        }
        else {
          this.title = "新增"
          this.dataForm.FBILLNO = "K" + Math.floor(Math.random() * 10000000) + 1;
          this.insertorupdate = true;
        }
        this.visible = true;
      },
      insert() {
        this.$refs.StudqueryFcuston.open();
      },
      shoplist(data) {
        data.forEach(item => {
          this.list.push({
            FBILLNO: this.dataForm.FBILLNO
            , FENTRYID: "1"
            , FYEAR: 2024
            , FGRADE: "大一"
            , FCLASS: "化学系1班"
            , FSTUDNAME: "曹操"
          },{
            FBILLNO: this.dataForm.FBILLNO
            , FENTRYID: "2"
            , FYEAR: 2024
            , FGRADE: "大一"
            , FCLASS: "化学系1班"
            , FSTUDNAME: "刘备"
          })
        });
      },
      //
      cancel() {
        this.$refs.elForm.resetFields();
        this.list = [];
        this.visible = false;
      },


    },
  };
</script>